package com.example.demo.controller

import com.example.demo.common.BaseResponse
import com.example.demo.common.ResultUtils
import com.example.demo.model.entity.AppUser
import com.example.demo.service.UserService
import com.fasterxml.jackson.databind.ser.Serializers.Base
import jakarta.annotation.Resource
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("/api/test")
class UserController {
    @Resource
    lateinit var userService: UserService
    @GetMapping("/users")
    fun getUsers() : BaseResponse<AppUser?>{
        return BaseResponse(userService.findUsers())
    }
    @GetMapping("/user/{id}")
    fun getUserById(@PathVariable id:Int) : BaseResponse<AppUser?>{
        return BaseResponse(userService.findUserById(id))
    }
}